home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / CALib & You… / Source / CASample / CAS_CTools.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-12-07  |  1.4 KB  |  55 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        CAS_CTools.c
  3.  
  4.     Contains:    InitTools. Also owns the tool GLOBALs.
  5.  
  6.     Written by:    David H Nelson
  7.  
  8.     Copyright © 1988-1995 ComponentWorks, All rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <1>     1988    DHN        Created.
  13.  
  14. */
  15.  
  16. #define _CTOOLS_
  17.  
  18. #include <GestaltEqu.h>
  19.  
  20. #include "CAS_Globals.h"
  21. #include "CAS_CTools.h"
  22.  
  23. #define kDragMgrTrap            0xABED
  24. #define kTEGetHiliteRgnTrap        0xA83D
  25.  
  26.  
  27. //---------------------------------------------------------------------------
  28. void InitTools(void)
  29. {
  30. OSErr        theErr;
  31. long        response;
  32.  
  33.     blockErase((Ptr)&firstGlobal, (&lastGlobal - &firstGlobal + sizeof(lastGlobal)) );
  34.  
  35.     // Check for System 7
  36.     theErr = Gestalt( gestaltSystemVersion, &response );
  37.     runningSystem7 = (!theErr && (response >= 0x0700));
  38.  
  39.     // Check for Color QuickDraw
  40.     theErr = Gestalt( gestaltQuickdrawVersion, &response );
  41.     hasColorQD = (!theErr && response >= gestalt8BitQD);
  42.     has32BitQD = (!theErr && response >= gestalt32BitQD);
  43.  
  44.     // Check for the drag mgr
  45.     // if gestalt fails the trap may still be implemented (System 7 Pro),
  46.     // but the API for the trap is different so we don't work.
  47.     theErr = Gestalt( gestaltDragMgrAttr, &response );
  48.     hasDragMgr = (!theErr && (response & (1<<gestaltDragMgrPresent)) != 0);
  49.  
  50.     // Check for TEGetHiliteRgn
  51.     theErr = Gestalt( gestaltTEAttr, &response );
  52.     hasTEGetHiliteRgn = (!theErr && (response & (1<<gestaltTEHasGetHiliteRgn)) != 0);
  53. }
  54.  
  55.